import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
//使用标准库里的阻塞队列
public class demo1 {
    public static void main(String[] args) throws InterruptedException {
        BlockingQueue<String> blockingQueue = new LinkedBlockingQueue<>();
        blockingQueue.put("111");
        blockingQueue.put("222");
        blockingQueue.put("333");
        blockingQueue.put("444");
        String elem = blockingQueue.take();
        System.out.println(elem);
        elem = blockingQueue.take();
        System.out.println(elem);
        elem = blockingQueue.take();
        System.out.println(elem);
        elem = blockingQueue.take();
        System.out.println(elem);
        elem = blockingQueue.take();
        System.out.println(elem);

    }
}
